package com.exam.user.service;

import com.exam.user.api.entity.SysPermission;
import com.exam.user.dao.SysPermissionDao;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;

@Service
public class SysPermissionServiceImpl implements SysPermissionService {

    @Resource
    private SysPermissionDao sysPermissionDao;

    @Override
    public void addPermission(SysPermission permission) {
            sysPermissionDao.addPermission(permission);
    }

    @Override
    public void deleteById(Integer id) {
        sysPermissionDao.deleteById(id);
    }

    @Override
    public void updatePermission(SysPermission permission) {
        sysPermissionDao.updatePermission(permission);
    }

    @Override
    public SysPermission getSingle(Integer id) {

        return sysPermissionDao.getSingle(id);
    }

    @Override
    public PageInfo<SysPermission> getAll(Integer pageNum,Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        PageInfo<SysPermission> info=new PageInfo<>(sysPermissionDao.getAll());
        return info;
    }

    @Override
    public List<SysPermission> getByLike(String name) {

        return sysPermissionDao.getByLike(name);
    }
}
